package com.java.imauoj.sercive;

import com.java.imauoj.mapper.ClassMapper;
import com.java.imauoj.moudel.Classes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassService {

    @Autowired
    private ClassMapper mapper;

    public List<Classes> getClassList(){
        List list =mapper.getClassList();
        return list;
    }

    public Classes addClass(Classes cla){
        mapper.addClass(cla);
        Classes classes = mapper.getClass(cla.getClass_id());
        return classes;
    }

    public Classes updateClass(Classes cla){
        mapper.updateClass(cla);
        Classes classes = mapper.getClass(cla.getClass_id());
        return classes;
    }

    public Classes deleteClass(int class_id){
        Classes classes = mapper.getClass(class_id);
        mapper.deleteClass(class_id);
        return classes;
    }
}
